﻿using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;

namespace DecorationSys.Controllers
{
    public class HomeController : Controller
    {

        /// <summary>
        /// 首页
        /// </summary>
        /// <returns></returns>
        public IActionResult Index()
        {

            //验证用户是否登录
            //去session找有没有用户的信息
            string userName = HttpContext.Session.GetString("UserName");
            if (userName == null)
            {
                //没有登录，重定向登录页
                //return Redirect("/Account/LoginView");

                return new RedirectResult("/Account/LoginView");
            }

            ViewBag.UserName = userName;

            return View();
        }

        /// <summary>
        /// 通知首页
        /// </summary>
        /// <returns></returns>
        public IActionResult NoticeIndex()
        {
            return View();
        }
    }
}